package org.plex.core.imp;

import java.io.Serializable;
import java.util.Date;

import org.plex.core.AuthResult;
import org.plex.core.Context;
import org.plex.model.User;
import org.plex.model.imp.UserImp;

public class ContextImp implements Context, Serializable
{
	private static final long		serialVersionUID	= 1078877166247011734L;
	private com.adobe.idp.Context	context;

	public ContextImp(com.adobe.idp.Context context)
			throws NullPointerException
	{
		if (context == null)
			throw new NullPointerException();
		this.context = context;
	}

	public static Context create(byte[] buf)
	{
		return new ContextImp(com.adobe.idp.Context.create(buf));
	}

	public User getAuthenticatedUser()
	{
		return new UserImp(this.context.getAuthenticatedUser());
	}

	public Date getExpirationHint()
	{
		// TODO Auto-generated method stub
		return this.context.getExpirationHint();
	}

	public String getRequestId()
	{
		// TODO Auto-generated method stub
		return this.context.getRequestId();
	}

	public String getUserAssertion()
	{
		// TODO Auto-generated method stub
		return this.context.getUserAssertion();
	}

	public void initPrincipal(AuthResult authResult)
	{
		AuthResultImp imp = (AuthResultImp) authResult;
		this.context.initPrincipal(imp.getAuthResult());
	}

	public void initRequestId(String requestId)
	{
		// TODO Auto-generated method stub

	}

	public boolean isComplete()
	{
		// TODO Auto-generated method stub
		return false;
	}

	public byte[] toByteArray()
	{
		// TODO Auto-generated method stub
		return null;
	}

	public void setContext(com.adobe.idp.Context context)
	{
		this.context = context;
	}

	public com.adobe.idp.Context getContext()
	{
		return context;
	}

}
